package cn.songhaiqing.walle.help;

import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.util.Log;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Map;

import cn.songhaiqing.walle.bean.ImgVersion;
import cn.songhaiqing.walle.global.Global;

public class DeviceHelper {
    public static final String[] ARRAY_DEVICE = {"_default", "_SH08", "_SH05", "_SH09", "_SH07", "_SH09U", "_I8", "_HMFITNESS", "_I7PLUS", "_I10", "_I3", "_I7S", "_H03PRO", "_SS", "_06P", "_T", "_S", "_H"};
    public static final int[] ARRAY_DEVICE_TYPE = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
    public static final int DEFAULT_T = 15;
    public static final int DEFAULT_t = 180;
    public static final int DEF_BATTERY_LEVEL = -1;
    public static final String DEVICE_06P = "06P";
    public static final String DEVICE_H = "H";
    public static final String DEVICE_H03PRO = "H03Pro";
    public static final String DEVICE_HM_FITNESS = "HM Fitness";
    public static final String DEVICE_I10 = "I10";
    public static final String DEVICE_I3 = "I3";
    public static final String DEVICE_I7S = "I7S";
    public static final String DEVICE_I7_PLUS = "I7PLUS";
    public static final String DEVICE_I8 = "I8";
    public static final String DEVICE_NAME = "Wristband";
    public static final String DEVICE_S = "S";
    public static final String DEVICE_SH05 = "SH05";
    public static final String DEVICE_SH06 = "SH06";
    public static final String DEVICE_SH07 = "Wristband7";
    public static final String DEVICE_SH071 = "SH07";
    public static final String DEVICE_SH08 = "Wristband";
    public static final String DEVICE_SH09 = "SH09";
    public static final String DEVICE_SH09u = "Wristband9U";
    public static final String DEVICE_SH09u2 = "SH09U";
    public static final String DEVICE_SS = "SS";
    public static final String DEVICE_T = "T";
    public static final String DEVICE_TYPE_I7_PLUS = "I7+";
    public static final String KEY_BATTERY_LEVEL = "KEY_BATTERY_LEVEL";
    public static final String KEY_DEFALUT_DEVICE = "KEY_DEFALUT_DEVICE";
    public static final String KEY_DEVICE_ADDRESS = "KEY_DEVICE_ADDRESS";
    public static final String KEY_DEVICE_ADDRESS_TEMP = "KEY_DEVICE_ADDRESS_TEMP";
    public static final String KEY_DEVICE_DIASTOLIC = "KEY_DEVICE_DIASTOLIC";
    public static final String KEY_DEVICE_NAME = "KEY_DEVICE_NAME";
    public static final String KEY_DEVICE_SYSTOLIC = "KEY_DEVICE_SYSTOLIC";
    public static final String KEY_HRV_T = "KEY_HRV_T";
    public static final String KEY_HRV_t = "KEY_HRV_t";
    public static final int TYPE_COMPAT_DEVICE_06 = 3;
    public static final int TYPE_COMPAT_DEVICE_I10 = 2;
    public static final int TYPE_COMPAT_DEVICE_I3 = 0;
    public static final int TYPE_COMPAT_DEVICE_I7_PLUS = 1;
    public static final int TYPE_DEVICE_06P = 14;
    public static final int TYPE_DEVICE_DEF = 0;
    public static final int TYPE_DEVICE_H = 17;
    public static final int TYPE_DEVICE_H03PRO = 12;
    public static final int TYPE_DEVICE_HM_FITNESS = 7;
    public static final int TYPE_DEVICE_I10 = 9;
    public static final int TYPE_DEVICE_I3 = 10;
    public static final int TYPE_DEVICE_I7S = 11;
    public static final int TYPE_DEVICE_I7_PLUS = 8;
    public static final int TYPE_DEVICE_I8 = 6;
    public static final int TYPE_DEVICE_NULL = -1;
    public static final int TYPE_DEVICE_S = 16;
    public static final int TYPE_DEVICE_SH05 = 2;
    public static final int TYPE_DEVICE_SH07 = 4;
    public static final int TYPE_DEVICE_SH08 = 1;
    public static final int TYPE_DEVICE_SH09 = 3;
    public static final int TYPE_DEVICE_SH09u = 5;
    public static final int TYPE_DEVICE_SS = 13;
    public static final int TYPE_DEVICE_T = 15;
    public static final String[] ARRAY_DEVICE_NAME = {"Wristband", "Wristband", DEVICE_SH05, "SH09", DEVICE_SH07, DEVICE_SH09u, "I8", DEVICE_HM_FITNESS, DEVICE_I7_PLUS, "I10", "I3", DEVICE_I7S, DEVICE_H03PRO, DEVICE_SS, DEVICE_06P, DEVICE_T, DEVICE_S, DEVICE_H};

    public static final String[] scanDeviceNames = {"Wristband", "SH09", "I3", "I10", DEVICE_I7_PLUS, "SH09U", DEVICE_I7S, DEVICE_H03PRO, DEVICE_SS, DEVICE_06P};

    public static boolean isCorrectDevice(String deviceName) {
        for (String scanName : scanDeviceNames) {
            if (scanName.equalsIgnoreCase(deviceName)) {
                return true;
            }
        }
        return deviceName.matches("T[1-10]") || deviceName.matches("S([A-Z]|[1-9])") || deviceName.matches("H(0[4-9]|1[0-9])");
    }

    public static boolean isT(String deviceName) {
        if (deviceName == null || !deviceName.matches("T[1-10]")) {
            return false;
        }
        return true;
    }

    public static boolean isS(String deviceName) {
        if (deviceName == null || !deviceName.matches("S([A-Z]|[1-9])")) {
            return false;
        }
        return true;
    }

    public static boolean isS1_9(String deviceName) {
        if (deviceName == null || !deviceName.matches("S[1-9]")) {
            return false;
        }
        return true;
    }

    public static boolean isSA_R(String deviceName) {
        if (deviceName == null || !deviceName.matches("S[A-R]")) {
            return false;
        }
        return true;
    }

    public static boolean isST_Z(String deviceName) {
        if (deviceName == null || !deviceName.matches("S[T-Z]")) {
            return false;
        }
        return true;
    }

    public static boolean isH(String deviceName) {
        if (deviceName == null || !deviceName.matches("H(0[4-9]|1[0-9])")) {
            return false;
        }
        return true;
    }

    public static boolean isH4_5(String deviceName) {
        if (deviceName == null || !deviceName.matches("H0[4-5]")) {
            return false;
        }
        return true;
    }

    public static boolean isH6_19(String deviceName) {
        if (deviceName == null || !deviceName.matches("H(0[6-9]|1[0-9])")) {
            return false;
        }
        return true;
    }

    public static void saveDefaultDevice(int defalutDevice) {
        SpHelper.putInt(KEY_DEFALUT_DEVICE, defalutDevice);
    }

    public static int getDefaultDevice() {
        return SpHelper.getInt(KEY_DEFALUT_DEVICE, 0);
    }

    public static void newSaveDeviceName(String name) {
        SpHelper.putString(KEY_DEVICE_NAME + ARRAY_DEVICE[getDefaultDevice()], name);
    }

    public static String getNewSaveDeviceName() {
        return SpHelper.getString(KEY_DEVICE_NAME + ARRAY_DEVICE[getDefaultDevice()], null);
    }

    public static void saveLastSystolicData(String data) {
        SpHelper.putString(KEY_DEVICE_SYSTOLIC + ARRAY_DEVICE[getDefaultDevice()], data);
    }

    public static String getLastSystolicData() {
        return SpHelper.getString(KEY_DEVICE_SYSTOLIC + ARRAY_DEVICE[getDefaultDevice()], null);
    }

    public static void saveLastDiastolicData(String data) {
        SpHelper.putString(KEY_DEVICE_DIASTOLIC + ARRAY_DEVICE[getDefaultDevice()], data);
    }

    public static String getLastDiastolicData() {
        return SpHelper.getString(KEY_DEVICE_DIASTOLIC + ARRAY_DEVICE[getDefaultDevice()], null);
    }

    public static void saveLastHrvT(int data) {
        SpHelper.putInt(KEY_HRV_T + ARRAY_DEVICE[getDefaultDevice()], data);
    }

    public static int getLastHrvT() {
        return SpHelper.getInt(KEY_HRV_T + ARRAY_DEVICE[getDefaultDevice()], 15);
    }

    public static void saveLastHrvt(int data) {
        SpHelper.putInt(KEY_HRV_t + ARRAY_DEVICE[getDefaultDevice()], data);
    }

    public static int getLastHrvt() {
        return SpHelper.getInt(KEY_HRV_t + ARRAY_DEVICE[getDefaultDevice()], DEFAULT_t);
    }

    public static String getDeviceName() {
        return ARRAY_DEVICE_NAME[getDefaultDevice()];
    }

    public static int getDefaultDeviceFirstStart() {
        return SpHelper.getInt(KEY_DEFALUT_DEVICE, -1);
    }

    public static int getBatteryLevel() {
        return SpHelper.getInt(KEY_BATTERY_LEVEL + ARRAY_DEVICE[getDefaultDevice()], -1);
    }

    public static void setBatteryLevel(int level) {
        SpHelper.putInt(KEY_BATTERY_LEVEL + ARRAY_DEVICE[getDefaultDevice()], level);
    }

    public static Boolean getWhichNotiChoose(String key) {
        return SpHelper.getBoolean(key + ARRAY_DEVICE[getDefaultDevice()], false);
    }

    public static void setWhichNotiChoose(String key, boolean isChoose) {
        SpHelper.putBoolean(key + ARRAY_DEVICE[getDefaultDevice()], isChoose);
    }

    public static String getBoundDeviceAddress() {
        return SpHelper.getString(KEY_DEVICE_ADDRESS + ARRAY_DEVICE[getDefaultDevice()], "DD:C3:BE:67:C1:16");
    }

    public static void saveBandAddress(String address) {
        SpHelper.putString(KEY_DEVICE_ADDRESS + ARRAY_DEVICE[getDefaultDevice()], address);
    }

    public static String receiveBeaconZoon(byte[] value) {
        String zoon ="1";// SyncResultHelper.parseZoon(value);
        System.out.println("zoon = " + zoon);
        return zoon;
    }

    public static void unBoundDevice(Context context) {
        saveBandAddress(null);
    }

    public static String getNearestDeviceAddress(Map<String, Integer> deviceMap) {
        if (deviceMap == null) {
            return null;
        }
        int rssiMax = -9999;
        String nearestDevice = null;
        for (String address : deviceMap.keySet()) {
            Integer rssiValue = deviceMap.get(address);
            if (rssiValue != null && rssiValue.intValue() > rssiMax) {
                rssiMax = rssiValue.intValue();
                nearestDevice = address;
            }
        }
        Log.i("SettingsFragment", "nearest address: " + nearestDevice);
        return nearestDevice;
    }

    public static boolean isSH05orSH09() {
        int device = getDefaultDevice();
        if (device == 2 || device == 3) {
            return true;
        }
        return false;
    }

    public static boolean isSH07() {
        if (getDefaultDevice() == 4) {
            return true;
        }
        return false;
    }

    public static boolean isSS() {
        if (getDefaultDevice() == 13) {
            return true;
        }
        return false;
    }

    public static boolean isSH09u() {
        if (getDefaultDevice() == 5) {
            return true;
        }
        return false;
    }

    public static boolean isHMFitness() {
        if (getDefaultDevice() == 7) {
            return true;
        }
        return false;
    }

    public static boolean isI7PLUS() {
        if (getDefaultDevice() == 8) {
            return true;
        }
        return false;
    }

    public static boolean isT() {
        if (getDefaultDevice() == 15) {
            return true;
        }
        return false;
    }

    public static boolean isI7S() {
        if (getDefaultDevice() == 11) {
            return true;
        }
        return false;
    }

    public static boolean isH03PRO() {
        if (getDefaultDevice() == 12) {
            return true;
        }
        return false;
    }

    public static boolean isI3() {
        if (getDefaultDevice() == 10) {
            return true;
        }
        return false;
    }

    public static boolean isI10() {
        if (getDefaultDevice() == 9) {
            return true;
        }
        return false;
    }

    public static boolean isI8() {
        if (getDefaultDevice() == 6) {
            return true;
        }
        return false;
    }

    public static boolean isSH08orSmartMovement() {
        if (getDefaultDevice() == 1 || "com.gzgamut.smart_movement.".equals("com.gzgamut.smart_movement.")) {
            return true;
        }
        return false;
    }

    public static boolean isSH05() {
        if (getDefaultDevice() == 2) {
            return true;
        }
        return false;
    }

    public static boolean isSH08() {
        if (getDefaultDevice() == 1) {
            return true;
        }
        return false;
    }

    public static boolean isSH06() {
        if (getDefaultDevice() == 0) {
            return true;
        }
        return false;
    }

    public static boolean is06P() {
        if (getDefaultDevice() == 14) {
            return true;
        }
        return false;
    }

    public static boolean isSH09() {
        if (getDefaultDevice() == 3) {
            return true;
        }
        return false;
    }

    public static boolean is09ShowHeart() {
        return SleepHelper.is09ShowHeart(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is09UShowHeart() {
        return SleepHelper.is09UShowHeart(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isI8ShowHeart() {
        return SleepHelper.isI8ShowHeart(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isNordic() {
        return SleepHelper.isNordic(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isNP() {
        return SleepHelper.is09or09uNordic_YuanXiang(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is07NB() {
        return SleepHelper.is07NB(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is07N0() {
        return SleepHelper.is07N0(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isSh09uColorScreen() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("SH09U")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20200101 = Calendar.getInstance();
            try {
                cal_20200101.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200101"));
                if (CalendarHelper.isDate1AfterDate2(cal_img, cal_20200101)) {
                    return true;
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isSh09uColorScreenNewSleep() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("SH09U")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20200701 = Calendar.getInstance();
            try {
                cal_20200701.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200701"));
                if (CalendarHelper.isDate1AfterDate2(cal_img, cal_20200701)) {
                    return true;
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isSh09uUnColorScreenNewSleep() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("SH09U")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20200101 = Calendar.getInstance();
            Calendar cal_20180529 = Calendar.getInstance();
            try {
                cal_20200101.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200101"));
                cal_20180529.setTime(FormatHelper.sdf_yyyyMMdd.parse("20180529"));
                if (!CalendarHelper.isDate1AfterDate2(cal_img, cal_20180529) || !CalendarHelper.isDate1BeforeDate2(cal_img, cal_20200101)) {
                    return false;
                }
                return true;
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isI10NewSleep() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("I10")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20200621 = Calendar.getInstance();
            try {
                cal_20200621.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200701"));
                if (CalendarHelper.isDate1AfterDate2(cal_img, cal_20200621)) {
                    return true;
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isSH09NewSleep() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("SH09")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20181203 = Calendar.getInstance();
            try {
                cal_20181203.setTime(FormatHelper.sdf_yyyyMMdd.parse("20181203"));
                if (CalendarHelper.isDate1AfterDate2(cal_img, cal_20181203)) {
                    return true;
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isI7PColorScreenNewSleep() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("I7+")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20200701 = Calendar.getInstance();
            try {
                cal_20200701.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200701"));
                if (CalendarHelper.isDate1AfterDate2(cal_img, cal_20200701)) {
                    return true;
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isSh09uColorScreenBefore20200227() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null && img.getType().equalsIgnoreCase("SH09U")) {
            Calendar cal_img = img.getDate();
            Calendar cal_20200101 = Calendar.getInstance();
            Calendar cal_20200227 = Calendar.getInstance();
            try {
                cal_20200101.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200101"));
                cal_20200227.setTime(FormatHelper.sdf_yyyyMMdd.parse("20200227"));
               /* if (!CalendarHelper.isDate1AfterDate2(cal_img, cal_20200101) || !CalendarHelper.isDate1BeforeDate2(cal_img, cal_20200227)) {
                    return false;
                }*/
                return true;
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public static boolean isSH09UHaveBraceletClean() {
        return SleepHelper.isSh09UHaveBraceletClean(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isI8NX() {
        return SleepHelper.isI8NX(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isNS() {
        return SleepHelper.is09or09uNordic_SongEn(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isNY() {
        return SleepHelper.is09or09uNordic_YuCheng(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isDeviceNP() {
        String version;
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img == null || (version = img.getVersion()) == null || !version.equalsIgnoreCase(Global.NORDIC_YUANXIANG)) {
            return false;
        }
        return true;
    }

    public static boolean isDeviceNX() {
        String version;
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img == null || (version = img.getVersion()) == null || !version.equalsIgnoreCase(Global.NORDIC_XINLV)) {
            return false;
        }
        return true;
    }

    public static boolean isDevice3X() {
        String version;
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img == null || (version = img.getVersion()) == null || !version.equalsIgnoreCase(Global.NORDIC_3X)) {
            return false;
        }
        return true;
    }

    public static boolean isDeviceI7P_1_NX() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_XINLV) || !number.equals("1") || !type.equalsIgnoreCase("I7+")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDeviceI10_1_NX() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_XINLV) || !number.equals("1") || !type.equalsIgnoreCase("I10")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDeviceI10_3_3X() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_3X) || !number.equals("3") || !type.equalsIgnoreCase("I10")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDeviceI10_3_NX() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_XINLV) || !number.equals("3") || !type.equalsIgnoreCase("I10")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDevice09U_2_NX() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_XINLV) || !number.equals("2") || !type.equalsIgnoreCase("SH09U")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDevice09U_1_3X() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_3X) || !number.equals("1") || !type.equalsIgnoreCase("SH09U")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDevice09U_1_NX() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_XINLV) || !number.equals("1") || !type.equalsIgnoreCase("SH09U")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isDeviceI10_1_3X() {
        ImgVersion img = VersionHelper.parserImgVersion(VersionHelper.getVersionWatch());
        if (img != null) {
            String version = img.getVersion();
            String number = img.getNumber();
            String type = img.getType();
            if (version == null || number == null || type == null || !version.equalsIgnoreCase(Global.NORDIC_3X) || !number.equals("1") || !type.equalsIgnoreCase("I10")) {
                return false;
            }
            return true;
        }
        return false;
    }

    public static boolean isNX() {
        return SleepHelper.is09or09uNordic_XinLv(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is3X() {
        return SleepHelper.is09or09uNordic_3X(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is09NotHaveFont() {
        return SleepHelper.is09NotHaveFont(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is2A() {
        return SleepHelper.is09or09u2640_AMS(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean is2S() {
        return SleepHelper.is09or09u2640_SongEn(VersionHelper.parserImgVersion(VersionHelper.getVersionWatch()));
    }

    public static boolean isSmartMovement() {
        if ("com.gzgamut.smart_movement.".equals("com.gzgamut.smart_movement.")) {
            return true;
        }
        return false;
    }

    public static String getDeviceAddressTemp() {
        return SpHelper.getString(KEY_DEVICE_ADDRESS_TEMP, null);
    }

    public static void setDeviceAddressTemp(String address) {
        SpHelper.putString(KEY_DEVICE_ADDRESS_TEMP, address);
    }

    public static boolean isDeviceOk(BluetoothDevice device) {
        if (device == null || device.getAddress() == null || device.getName() == null) {
            return false;
        }
        return true;
    }
}
